import request from '@/utils/request'
import { fileService, salaryDataService } from '@/utils/requestUrl'
/**
 * 获取财政区域
 */
export function getAgencyMofDiv() {
  return request({
    url: '/agencyApiController/getAgencyMofDiv',
    method: 'get'
  })
}

/**
 * 获取人员来源
 */
export function getAgencyPersou() {
  return request({
    url: '/agencyApiController/getAgencyPersou',
    method: 'get'
  })
}

/**
 * 获取人员身份
 */
export function getAgencyPeride() {
  return request({
    url: '/agencyApiController/getAgencyPeride',
    method: 'get'
  })
}

/**
 * 获取人员状态
 */
export function getAgencyPersta() {
  return request({
    url: '/agencyApiController/getAgencyPersta',
    method: 'get'
  })
}

/**
 * 获取单位类型
 */
export function getAgencyAdmdep() {
  return request({
    url: '/agencyApiController/getAgencyAdmdep',
    method: 'get'
  })
}

/**
 * 获取单位行政级别
 */
export function getAgencyAgencyadmlevel() {
  return request({
    url: '/agencyApiController/getAgencyAgencyadmlevel',
    method: 'get'
  })
}

/**
 * 获取银行
 */
export function getAgencyBank() {
  return request({
    url: '/agencyApiController/getAgencyBank',
    method: 'get'
  })
}

/**
 * 获取证件类型代码
 */
export function getCitType() {
  return request({
    url: '/agencyApiController/getCitType',
    method: 'get'
  })
}

/**
 * 获取学历代码
 */
export function getSchrec() {
  return request({
    url: '/agencyApiController/getSchrec',
    method: 'get'
  })
}

/**
 * 获取职务
 */
export function getPosgr() {
  return request({
    url: '/agencyApiController/getPosgr',
    method: 'get'
  })
}

/**
 * 获取职级
 */
export function getGr() {
  return request({
    url: '/agencyApiController/getGr',
    method: 'get'
  })
}

/**
 * 获取技术等级
 */
export function getTecgr() {
  return request({
    url: '/agencyApiController/getTecgr',
    method: 'get'
  })
}

/**
 * 获取工资级别
 */
export function getSalagr() {
  return request({
    url: '/agencyApiController/getSalagr',
    method: 'get'
  })
}

/**
 * 获取性别
 */
export function getSex() {
  return request({
    url: '/agencyApiController/getSex',
    method: 'get'
  })
}

/**
 * 获取民族代码
 */
export function getNat() {
  return request({
    url: '/agencyApiController/getNat',
    method: 'get'
  })
}

/**
 * 获取国籍
 */
export function getCountry() {
  return request({
    url: '/agencyApiController/getCountry',
    method: 'get'
  })
}

/**
 * 获取人员经费保障方式
 */
export function getFundmode() {
  return request({
    url: '/agencyApiController/getFundmode',
    method: 'get'
  })
}

/**
 * 获取支付方式
 */
export function getPayType() {
  return request({
    url: '/agencyApiController/getPayType',
    method: 'get'
  })
}

/**
 * 获取项目分类
 */
export function getProCat() {
  return request({
    url: '/agencyApiController/getProCat',
    method: 'get'
  })
}

/**
 * 获取预算项目
 */
export function getPro() {
  return request({
    url: '/agencyApiController/getPro',
    method: 'get'
  })
}

/**
 * 获取部门支出经济分类
 */
export function getDepBgtEco() {
  return request({
    url: '/agencyApiController/getDepBgtEco',
    method: 'get'
  })
}

/**
 * 获取部门支出经济分类
 */
 export function getBaseDataFunc() {
  return request({
    url: '/agencyApiController/getBaseDataFunc',
    method: 'get'
  })
}

/**
 * 获取政府经济分类
 */
export function getGovBgtEco() {
  return request({
    url: '/agencyApiController/getGovBgtEco',
    method: 'get'
  })
}

/**
 * 获取政府经济分类树
 */
 export function getGovBgtEcoTree() {
  return request({
    url: '/agencyApiController/getGovBgtEcoTree',
    method: 'get'
  })
}
/**
 * 获取工资类别
 */
export function getPayCategory() {
  return request({
    url: '/agencyApiController/getPayCategory',
    method: 'get'
  })
}
/**
 * 获取权限单位树
 */
export function getAuthAgencyTree() {
  return request({
    url: '/agencyApiController/getAuthAgencyTree',
    method: 'get'
  })
}

/**
 * 获取权限单位树(过滤批量财务已上报)
 */
 export function getAuthAgencyTrees() {
  return request({
    url: '/agencyApiController/getAuthAgencyTrees',
    method: 'get'
  })
}

/**
 * 根据isLeaf获取id
 */
 export function getIsLeafIds() {
  return request({
    url: '/agencyInfoController/getIsLeafIds',
    method: 'get'
  })
}

export function getFirstAuthAgencyData() {
  return request({
    url: '/agencyApiController/getFirstAuthAgencyData',
    method: 'get'
  })
}
/**
 * 获取单位树
 */
export function getAgencyTree(query) {
  return request({
    url: '/agencyApiController/getAgencyTree',
    method: 'get',
    params: query
  })
}

/**
 * 获取单位列表
 */
export function getAgencyList(query) {
  return request({
    url: '/agencyInfoController/getAllAgency',
    method: 'get',
    params: query
  })
}

// 导出模板
export function Export() {
  return request({
    url: '/boss_Salary_vue/excel/downloadModel',
    method: 'get',
    responseType: 'blob'
  })
}

// 导入
export function Import(data) {
  const config = {
    'Content-Type': 'mutipart/form-data;boundary=' + new Date().getTime()
  }
  return request({
    url: '/boss_Salary_vue/excel/upload',
    type: 'upload',
    method: 'post',
    data,
    config
  })
}

// 附件上传
export function Upload(data) {
  const config = {
    'Content-Type': 'mutipart/form-data;boundary=' + new Date().getTime()
  }
  return request({
    url: fileService + 'v2/upload',
    method: 'post',
    data,
    config,
    type: 'upload'
  })
}

// 附件查询
export function attachmentPreservation(data) {
  return request({
    url: '/fileInfoController/getFileInfo',
    method: 'post',
    data
  })
}
// 附件查询
export function queryExcel(data) {
  return request({
    url: '/fileInfoController/queryExcel',
    method: 'post',
    data
  })
}
// 附件保存
export function save(data) {
  return request({
    url: '/fileInfoController/insertFileInfo',
    method: 'post',
    data
  })
}

// 批量附件保存
export function insertFileInfoList(data) {
  return request({
    url: '/fileInfoController/insertFileInfoList',
    method: 'post',
    data
  })
}

// 附件下载;预览
export function attachmentDownload(query) {
  return request({
    url: fileService + 'v2/download-file',
    method: 'get',
    responseType: 'blob',
    params: query
  })
}

// 附件删除
export function attachmentDelete(data) {
  return request({
    url: '/fileInfoController/deleteFileInfo',
    method: 'post',
    data
  })
}

// 附件批量删除
export function attachmentDeleteByIds(data) {
  return request({
    url: '/fileInfoController/deleteEnclosureByIds',
    method: 'post',
    data
  })
}

// 查询工资编报
export function getSalaryState(query) {
  return request({
    url: '/agencySalaryController/getSalaryState',
    method: 'get',
    params: query
  })
}

export function exportSalaryData(fileName, province,sendBankCode) {
  return request({
    url: salaryDataService + '/salary/exportSalaryFile',
    method: 'get',
    params: {
      fileName,
      province,
      sendBankCode
    },
    responseType: 'blob'
  })
}
// 审核流程
export function getApprovalProcess(agencyId) {
  return request({
    url: '/salaryWorkFlowController/getAuditInstruction',
    method: 'get',
    params: { agencyId }
  })
}

/**
 * 获取人员类型
 */
export function getSalaryType() {
  return request({
    url: '/agencyApiController/getSalaryType',
    method: 'get'
  })
}

/**
 * 获取控制配置
 */
 export function getConfigCtrlByTypeMof(type) {
  return request({
    url: '/agencyApiController/getConfigCtrlByTypeMof',
    method: 'get',
    params: { type }
  })
}

/**
 * 获取未审核单位树
 */
 export function getNotAuditAuthAgencyTree() {
  return request({
    url: '/agencyApiController/getNotAuditAuthAgencyTree',
    method: 'get'
  })
}